Skip to content

guard test: a stale Moment doesn't guard a write - #52

Merged
jallers merged 1 commit into
proposed_type_script_api_versionfrom
ccr-21370f44-nm031v-moment-guard
Nov 11, 2026
Merged

jallers merged 1 commit into
proposed_type_script_api_versionfrom
ccr-21370f44-nm031v-moment-guard

Conversation

@jallers

@jallers jallers commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Adds the write-side check suggested on #51. src/services/guard.ts says "a Moment guard guards nothing", but test/integration/guard.test.ts had only shown it for a query. This pins it for a write, so the guard isn't switched to Moment later.

Changes

  • New live test in test/integration/guard.test.ts, "why not Moment, on a write". It uses its own throwaway Story, so it doesn't depend on test order:
    • an update filtered on a stale Moment (as a literal) previews as 1 command, and when sent it applies, overwriting the change made in between;
    • for contrast, the same update filtered on the stale ChangeDate literal, which is what guard.ts sends, previews as [] and applies nothing.
  • guard.ts: its comment now cites the write case and guard: research an exact stamp for the compare-and-set (Moment, ChangeDateUTC, or a moment-qualified OID) #51. The test file's header now says Moment fails as a guard "for a query or for a write".

No source behaviour changes.

Testing

  • Live on v1sdktesting: npm run test:integration -- test/integration/guard.test.ts → 4 passed. The test's Story is deleted in the existing afterAll.
  • npm run verify: typecheck, build, and 127 unit tests pass.

Context: the Agility MCP write-safety proposal had treated a Moment filter as a compare-and-set. The live results on #51 show it isn't, and the proposal is being corrected to guard on a ChangeDate literal, with an exact expectedMoment precondition proposed for Core.


Generated by Claude Code

guard.ts says a Moment guard guards nothing, but test/integration/
guard.test.ts had only shown it for a query. The new live test covers
a write, on its own throwaway Story:

- An update filtered on a stale Moment (as a literal) previews as one
  command, and when sent it applies, overwriting the change made in
  between.
- For contrast, the same update filtered on the stale ChangeDate literal,
  which is what guard.ts sends, previews as nothing and applies nothing.

This pins the behaviour so the guard isn't switched to Moment later.
guard.ts's comment now cites the write case. Found while checking the
Agility MCP write-safety proposal; results are on #51.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016NSWj8mSZ8LrMj16R2cozL
@jallers
jallers merged commit c987713 into proposed_type_script_api_version Nov 11, 2026
4 checks passed
@jallers
jallers deleted the ccr-21370f44-nm031v-moment-guard branch November 11, 2026 16:30
@jallers jallers mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants